/* main.c */

#include "app_inc.h"
#include "fsl_edma.h"
#include "fsl_uart.h"

#include <stdint.h>

#include "shell.h"

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x)	(sizeof(x) / sizeof((x)[0]))
#endif

/* a test command */
int test_fun(int argc, char *argv[])
{
    printf("This is an test function\r\n");
    printf("argc:%d\r\n", argc);
    return 0;
}

/* reset command */
int cmd_reset(int argc, char *argv[])
{
    printf("software reset now!...\r\n");
    NVIC_SystemReset();
    return 0;
}


static struct sh_cmd cmds[] = 
{
    { test_fun, "test", "test function help string"},
    { cmd_reset, "reset", "software reset"},

    /* ... more cmd */
};


int main(void)
{
    
    /* Initialize the board. */
    BSP_InitSystem();
    BSP_InitStdioUART(115200);
    
    printf("\r\nShell Test\r\n");
    
    while(1)
    {
        shell_loop("SHELL", cmds, ARRAY_SIZE(cmds));
    }

}

